<%@page language="java" import="java.util.*"
	contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>比价网</title>

<jsp:useBean id="navbarLocation" scope="session"
	class="java.lang.String" />
<jsp:useBean id="userType" scope="session" class="java.lang.String" />
<jsp:useBean id="isLogin" scope="session" class="java.lang.String" />
<jsp:useBean id="account" scope="session" class="java.lang.String" />
<jsp:useBean id="password" scope="session" class="java.lang.String" />
<jsp:useBean id="remember" scope="session" class="java.lang.String" />

<link type="text/css"
	href="<%=request.getContextPath() + "/bootstrap/css/bootstrap.css"%>"
	rel="stylesheet" media="screen">
<link type="text/css"
	href="<%=request.getContextPath()
					+ "/bootstrap/css/bootstrap-responsive.css"%>"
	rel="stylesheet" media="screen">
<link type="text/css"
	href="<%=request.getContextPath() + "/template/header.css"%>"
	rel="stylesheet" media="screen">
<link type="text/css"
	href="<%=request.getContextPath() + "/template/footer.css"%>"
	rel="stylesheet" media="screen">

<!-- 根据navbarLocation的值选择导入的css文件 -->
<%
	if (navbarLocation.equals("") || navbarLocation.equals("home")) {
%>
<link type="text/css"
	href="<%=request.getContextPath() + "/index/index.css"%>"
	rel="stylesheet" media="screen">
<%
	} else if (navbarLocation.equals("searchGoods")) {
%>
<link type="text/css"
	href="<%=request.getContextPath()
						+ "/customer/css/searchGoods.css"%>"
	rel="stylesheet" media="screen">
<%
	} else if (navbarLocation.equals("goodsInfo")) {
%>
<link type="text/css"
	href="<%=request.getContextPath()
						+ "/customer/css/goodsInfo.css"%>"
	rel="stylesheet" media="screen">
<%
	}
%>

<script type="text/javascript">
    var baseUrl = "<%=request.getContextPath()%>";
</script>
<script type="text/javascript"
	src="<%=request.getContextPath() + "/jquery/jquery-1.9.1.js"%>"></script>
<script type="text/javascript"
	src="<%=request.getContextPath() + "/bootstrap/js/bootstrap.js"%>"></script>
<script type="text/javascript"
	src="<%=request.getContextPath() + "/template/header.js"%>"></script>
<!-- 根据navbarLocation的值选择导入的js文件 -->
<%
	if (navbarLocation.equals("home")) {
%>
<%
	}
%>
</head>

<body>
	<div class="navbar-wrapper">
		<div class="navbar navbar-static-top">
			<div class="navbar-inner">
				<div class="container">
					<button type="button" class="btn btn-navbar" data-toggle="collapse"
						data-target=".nav-collapse">
						<span class="icon-bar"></span> <span class="icon-bar"></span> <span
							class="icon-bar"></span>
					</button>
					<a class="brand" href="#">PriceComparison</a>
					<div class="nav-collapse collapse">
						<ul class="nav">
							<li
								class="<%if ((navbarLocation.equals("")) || (navbarLocation.equals("home"))) {%>active<%}%>"><a
								href="<%=request.getContextPath() + "/common/index"%>">主页</a></li>
							<%
								if (userType.equals("customer")) {
							%>
							<%
								} else if (userType.equals("manager")) {
							%>
							<%
								}
							%>
						</ul>
						<ul class="nav pull-right">
							<form class="navbar-search pull-left"
								action="<%=request.getContextPath() + "/search/find"%>"
								method="post">
								<input type="text" class="search-query" name="search_input"
									placeholder="搜索商品">
							</form>
							<%
								if (!isLogin.equals("yes")) {
							%>
							<li><a href="#myLoginModal" data-toggle="modal">登录</a></li>
							<%
								} else {
							%>
							<li><a href="javascript:void(0)" onclick="logout();">退出</a></li>
							<%
								}
							%>
						</ul>
					</div>
				</div>
			</div>
		</div>
	</div>

	<!--下面的是登录框-->
	<div id="myLoginModal" class="modal hide fade" tabindex="-1"
		role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
		<div class="modal-header">
			<h4>欢迎登录Dessert House</h4>
		</div>
		<div id="loginHolder" class="modal-body">
			<form class="form-horizontal">
				<div class="control-group">
					<label class="control-label" for="inputAccount">用户名</label>
					<div class="controls">
						<input type="text" id="inputAccount" placeholder="Account"
							value="<%if (remember.equals("yes")) {%><%=account%><%}%>">
					</div>
				</div>
				<div class="control-group">
					<label class="control-label" for="inputPassword">密码</label>
					<div class="controls">
						<input type="password" id="inputPassword" placeholder="Password"
							value="<%if (remember.equals("yes")) {%><%=password%><%}%>">
					</div>
				</div>
				<div class="control-group">
					<div class="controls">
						<label class="checkbox"> <input type="checkbox"
							id="inputRemember" <%if (remember.equals("yes")) {%> checked
							<%}%>>记住用户名和密码
						</label>
					</div>
				</div>
			</form>
		</div>
		<div class="modal-footer">
			<button class="btn" onclick="cancel();">取消</button>
			<button class="btn btn-primary" onclick="login();">登录</button>
		</div>
	</div>

	<script type="text/javascript">
		$('#myLoginModal').on('hidden', function() {
			document.getElementById("inputAccount").value = "";
			document.getElementById("inputPassword").value = "";
			var errorHolder = document.getElementById("errorHolder");
			if (errorHolder) {
				document.getElementById("errorInfo").innerHTML = "";
			}
			document.getElementById("inputRemember").checked = false;
		});
	</script>